package com.aptech.session;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

/**
 * 获得hibernate的单例Session类
 * @author Administrator
 *
 */
public class GetSessionFactory {

		private static GetSessionFactory instance;
		private SessionFactory sessionFactory;
		
		public static synchronized GetSessionFactory getInstance(){
			if(instance==null){
				instance=new GetSessionFactory();
			}
			return instance;
		}
			
		private GetSessionFactory(){
			this.sessionFactory=new Configuration().configure().buildSessionFactory();
		}
		
		public SessionFactory getSessionFactory(){
			return this.sessionFactory;
		}
}
